﻿@model Bricks.Site.Models.QualityCircularView

@{
    ViewBag.Title = "选择通报";
    Layout = "~/Views/Shared/_UserPage.cshtml";
}
<script type="text/javascript" src="/Res/easyui/plugins/jquery.datagrid-detailview.js"></script>

<script type="text/javascript">
    $(function () {
        initTable();
    });
    function initTable(queryData) {
        $('#qualityCircularDataGrid').datagrid({
            url: '/QualityCircular/GetDataList',
            //iconCls: 'icon-bricks',
            nowrap: true,
            autoRowHeight: false,
            striped: true,
            collapsible: true,
            pagination: true,
            pageSize: 20,
            rownumbers: true,
            //sortName: 'ID',    //根据某个字段给easyUI排序
            //sortOrder: 'asc',
            remoteSort: false,
            idField: 'ID',
            checkOnSelect: true,
            selectOnCheck: true,
            singleSelect: true,
            queryParams: queryData,  //异步查询的参数
            toolbar: '#circularToolBar',
            columns: [[
                //{
                //    field: 'IsChecked',
                //    formatter: function (value, row, index) {
                //        if (value == true) {
                //            return '<input type="checkbox" checked="true" onclick="ChooseBid.ChangeChecked(' + index + ');" />';
                //        }
                //        else {
                //            return '<input type="checkbox" onclick="ChooseBid.ChangeChecked(' + index + ');" />';
                //        }
                //    }
                //},
                { field: 'ck', checkbox: true },
                { title: '@Html.LabelFor(model => model.CircularName)', field: 'CircularName', width: 250, sortable: true },
                { title: '@Html.LabelFor(model => model.PublishTime)', field: 'PublishTime', width: 140, sortable: true, formatter: function (value, rec) { if (value) { return dateConvert(value); } } },  //此处进行时间格式转换
                //{ title: '@Html.LabelFor(model => model.PublishTime)', field: 'PublishTime', width: 100, sortable: true },
                { title: '@Html.LabelFor(model => model.PublishOrg)', field: 'PublishOrg', width: 120, sortable: true },
                { title: '@Html.LabelFor(model => model.PublishUser)', field: 'PublishUser', width: 80, sortable: true },
                {
                    title: '@Html.LabelFor(model => model.IsCorrective)', field: 'IsCorrective', width: 60, sortable: true, align: "center",
                    formatter: function (value, row, index) {
                        return $.GetYesOrNo(value);  //是否禁用图标（是/否）
                    }
                },
                { title: 'ID', field: 'ID', hidden: true },
                { title: 'Content', field: 'Content', hidden: true }
            ]],
            view: detailview,
            detailFormatter: function (index, row) {
                return '<div id="ddv-' + index + '" style="padding:1px 0"></div>';
            },
            onExpandRow: function (index, row) {
                $('#ddv-' + index).panel({
                    border: false,
                    cache: false,
                    href: '/QualityCircular/CircularDataGridDetail?id=' + row.ID,
                    onLoad: function () {
                        $('#qualityCircularDataGrid').datagrid('fixDetailRowHeight', index);
                    }
                });
                $('#qualityCircularDataGrid').datagrid('fixDetailRowHeight', index);
            }
        });
    }
    var ChooseCircular = {

    }
</script>

<table id="qualityCircularDataGrid" style="height: 500px;"></table>
